﻿using AutoMapper;
using MediatR;
using S.Organization.API.Application.Command.FieldSettingCommand;
using S.Organization.Domian.Model;
using S.Organization.Infrastructure;

namespace S.Organization.API.Application.CommandHandler.FieldSettingCommandHandler
{
    public class DelFieldSettingCommandHandler:IRequestHandler<DelFieldSettingCommand,int>
    {

        private readonly IBaseRepository<FieldSetting> _repository; 

        public DelFieldSettingCommandHandler(IBaseRepository<FieldSetting> repository)
        {
            _repository = repository; 
        }

        public Task<int> Handle(DelFieldSettingCommand request, CancellationToken cancellationToken)
        {
            return _repository.DeleteAsync(request.id);
        }
    }
}
